<?php include('header.php'); ?>
<script type="text/javascript">
$(document).ready(function() {
	$('#country_id').change(function(){
		populate_zone_menu();
	});	

});
// context is ship or bill
function populate_zone_menu(value)
{
	$.post('<?php echo site_url('locations/get_zone_menu');?>',{id:$('#country_id').val()}, function(data) {
		$('#zone_id').html(data);
	});
}
</script>
	<?php /*
	function list_restaurants($ress, $sub='') {
		foreach ($ress as $res): ?>
			<h3><a href="<?php echo site_url($res['restaurant']->slug); ?>"><?php echo  $res['restaurant']->name; ?></h3>
			
			<img class="img-circle" style = "height:140px; width:140px;" src="<?php echo base_url('uploads/images/thumbnails/'.$res['restaurant']->image);?>" />
			
		<?php endforeach;
	}
	list_restaurants($restaurants); */?>
	
	<div class="page-header">
		<h1>&nbsp;&nbsp;&nbsp;<?php echo 'LIST RESTAURANT' ?></h1>
	</div>
	
	
	<div class="container">
		<div class="span8">
			
			<?php if(count($restaurants) > 0):?>
				
				<div style="float:left;"><?php echo $this->pagination->create_links();?></div>
				<br style="clear:both;"/>
				<ul class="thumbnails category_container">
				<?php foreach($restaurants as $res):?>
				<a href="<?php echo site_url(implode('/', $base_url).'/'.$res['restaurant']->slug); ?>">
				
				<div class="span8" style="border: 1px solid #ddd;
				  -webkit-border-radius: 4px;
					 -moz-border-radius: 4px;
						  border-radius: 4px;
				  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
					 -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
						  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
				  -webkit-transition: all 0.2s ease-in-out;
					 -moz-transition: all 0.2s ease-in-out;
					   -o-transition: all 0.2s ease-in-out;
						  transition: all 0.2s ease-in-out;">
					<li class="span3 product">
						
						
						
							<img class="img-polaroid" style = "height:140px; width:250px;" src="
							<?php 
								if(!empty($res['restaurant']->image[0])){
									echo base_url('uploads/images/thumbnails/'.$res['restaurant']->image);
								} else {
									echo base_url('uploads/images/thumbnails/no_picture.png');
								}
							?>" />
							
						
						
						
						
						
					</li>
					<li class="span3 product">
					<table>
					<tr>&nbsp;&nbsp;</tr>
					<tr>
					<td>
					<b>Nama Restaurant</b>
					</td>
					<td>&nbsp;:&nbsp;</td><td>
					<?php echo $res['restaurant']->name;?> 
					</td>
					</tr>
					<tr>
					<td>
					<b>Jam Buka</b>
					</td>
					<td>&nbsp;:&nbsp;</td><td>
					<?php echo $res['restaurant']->jam_buka;?> WIB
					</td>
					</tr>
					<tr>
					<td>
					<b>Jam Tutup</b>
					</td>
					<td>&nbsp;:&nbsp;</td><td>
					<?php echo $res['restaurant']->jam_tutup;?> WIB
					</td>
					</tr>
					</table>
					
					</li></a>
					</div>&nbsp;<div>
				<?php endforeach?>
				</ul>
			<?php endif;?>
			
		</div>
		<div class="span3">
			<div class="pull-right" style="margin-top:20px;">
				
					<div class="span3">
						<ul class="nav nav-list well">
						<li class="nav-header">
							Cari :
						</li>
						<?php 
						$address_form_prefix = 'bill';
						$countries = $this->Location_model->get_countries_menu();

						if(!empty($customer[$address_form_prefix.'_address']['country_id']))
						{
							$zone_menu	= $this->Location_model->get_zones_menu($customer[$address_form_prefix.'_address']['country_id']);
						}
						else
						{
							$zone_menu = array(''=>'')+$this->Location_model->get_zones_menu(array_shift(array_keys($countries)));
						}
						?>
						<?php echo form_open('cart/list_res');?>
						
						<li>
						<?php 
						echo form_dropdown('country_id',$countries, @$customer[$address_form_prefix.'_address']['country_id'], 'id="country_id" class="form-control"');
						?>
						</li>
						
						<li>
						<?php
						echo form_dropdown('zone_id',$zone_menu, @$customer[$address_form_prefix.'_address']['zone_id'], 'id="zone_id" class="form-control"');
						?>
						
						
						<li>
						<center>
						<input type="text" name="term" class="search-query span2" placeholder="<?php echo lang('search');?>"/>
						</center>
						</li>
						
					</div>
				</div>
		</div>
	</div>


<script type="text/javascript">
	window.onload = function(){
		$('.product').equalHeights();
	}
</script>
<?php include('footer.php'); ?>